package com.ysh.gsm;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * @author ysh
 *
 */
@Entity
@Table(name = "time_dimension")

@NamedQueries( {
	@NamedQuery(name = "timeDimensions.findAll", query = "from TimeDimension"),
	@NamedQuery(name = "timeDimensions.byId", query = "select t from TimeDimension t where t.timeKey= :timeKey"),
	@NamedQuery(name = "timeDimensions.dt",
	query = "select t from TimeDimension t where t.year= ?1 and t.month=?2 and t.day=?3 and t.hour=?4")
	
})
public class TimeDimension implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3280586315770664735L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "time_key")
	private Integer timeKey;
	@Column(name = "year")
	private int year;
	@Column(name = "month")
	private int month;
	@Column(name = "day")
	private int day;
	@Column(name = "hour")
	private int hour;
	@Column(name = "day_of_week")
	private int dayOfWeek;
	@Column(name = "holiday")
	private int holiday;
	@Column(name = "julian_day")
	private int juLianDay;
	@Column(name = "fisc_year")
	private int fiscYear;
	@Column(name = "fisc_week")
	private int fiscWeek;
	
	
	public TimeDimension(int y,int m,int d, int h,int dow,int ho,int ju,int fy,int fw){
		this.year=y;
		this.month=m;
		this.day=d;
		this.hour=h;
		this.dayOfWeek=dow;
		this.holiday=ho;
		this.juLianDay=ju;
		this.fiscYear=fy;
		this.fiscWeek=fw;
	}
	public TimeDimension(){
		super();
	}
	public Integer getTimeKey() {
		return timeKey;
	}
	public void setTimeKey(Integer timeKey) {
		this.timeKey = timeKey;
	}
	public int getYear() {
		return year;
	}
	public void setYear(int year) {
		this.year = year;
	}
	public int getMonth() {
		return month;
	}
	public void setMonth(int month) {
		this.month = month;
	}
	public int getDay() {
		return day;
	}
	public void setDay(int day) {
		this.day = day;
	}
	public int getHour() {
		return hour;
	}
	public void setHour(int hour) {
		this.hour = hour;
	}
	public int getDayOfWeek() {
		return dayOfWeek;
	}
	public void setDayOfWeek(int dayOfWeek) {
		this.dayOfWeek = dayOfWeek;
	}
	public int getHoliday() {
		return holiday;
	}
	public void setHoliday(int holiday) {
		this.holiday = holiday;
	}
	public int getJuLianDay() {
		return juLianDay;
	}
	public void setJuLianDay(int juLianDay) {
		this.juLianDay = juLianDay;
	}
	public int getFiscYear() {
		return fiscYear;
	}
	public void setFiscYear(int fiscYear) {
		this.fiscYear = fiscYear;
	}
	public int getFiscWeek() {
		return fiscWeek;
	}
	public void setFiscWeek(int fiscWeek) {
		this.fiscWeek = fiscWeek;
	}
	public int hashCode() {
		return timeKey.intValue();
	}
	

}
